package com.serkol.ams.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.serkol.ams.entity.CloudOrderDetail;
import com.serkol.ams.entity.Goods;
import com.serkol.ams.mapper.CloudOrderDetailMapper;
import com.serkol.ams.modal.SqlFeildModal;
import com.serkol.ams.service.CloudOrderDetailService;
import com.serkol.ams.service.GoodsService;
import com.serkol.handler.MyLambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
* @author pingan
* @description 针对表【cloud_order_detail】的数据库操作Service实现
* @createDate 2022-10-23 12:56:09
*/
@Service
public class CloudOrderDetailServiceImpl extends ServiceImpl<CloudOrderDetailMapper, CloudOrderDetail>
    implements CloudOrderDetailService{
    @Autowired
    private GoodsService goodsService;

    @Override
    public List<Map<String, Object>> findByOrderDetailList(long orderId) {

        QueryWrapper<CloudOrderDetail> queryWrapper = new QueryWrapper<>();
        queryWrapper.select(SqlFeildModal.getOrderCloudDetailFeild());
        queryWrapper.lambda().eq(CloudOrderDetail::getOrderId, orderId);
        return this.listMaps(queryWrapper);
    }

    @Override
    public List<Map<String, Object>> findGoodsList(long agentId) {

        MyLambdaQueryWrapper<Goods> queryWrapper=new MyLambdaQueryWrapper<>();
        queryWrapper.select(SqlFeildModal.getGoodsOrderCloudNewListFeild(agentId));

        return goodsService.listMaps(queryWrapper);
    }
}




